package com.ruoyi.hotel.service.impl;

import java.util.List;
import java.util.Date;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.hotel.mapper.HotelFloorMapper;
import com.ruoyi.hotel.domain.HotelFloor;
import com.ruoyi.hotel.service.IHotelFloorService;

/**
 * 楼层Service业务层处理
 *
 * @author sunye
 * @date 2024-11-15
 */
@Service
public class HotelFloorServiceImpl extends ServiceImpl<HotelFloorMapper, HotelFloor> implements IHotelFloorService
{
    @Autowired
    private HotelFloorMapper hotelFloorMapper;

    /**
     * 查询楼层
     *
     * @param floorId 楼层主键
     * @return 楼层
     */
    @Override
    public HotelFloor selectHotelFloorByFloorId(Long floorId)
    {
        return hotelFloorMapper.selectHotelFloorByFloorId(floorId);
    }

    /**
     * 查询楼层列表
     *
     * @param hotelFloor 楼层
     * @return 楼层
     */
    @Override
    public List<HotelFloor> selectHotelFloorList(HotelFloor hotelFloor)
    {
        return hotelFloorMapper.selectHotelFloorList(hotelFloor);
    }

    /**
     * 新增楼层
     *
     * @param hotelFloor 楼层
     * @return 结果
     */
    @Override
    public int insertHotelFloor(HotelFloor hotelFloor)
    {
    Date date = DateUtils.getNowDate();
            hotelFloor.setCreateTime(date);
            hotelFloor.setUpdateTime(date);
        return hotelFloorMapper.insert(hotelFloor);
    }

    /**
     * 修改楼层
     *
     * @param hotelFloor 楼层
     * @return 结果
     */
    @Override
    public int updateHotelFloor(HotelFloor hotelFloor)
    {
        hotelFloor.setUpdateTime(DateUtils.getNowDate());
        return hotelFloorMapper.updateById(hotelFloor);
    }

    /**
     * 批量删除楼层
     *
     * @param floorIds 需要删除的楼层主键
     * @return 结果
     */
    @Override
    public int deleteHotelFloorByFloorIds(Long[] floorIds)
    {
        return hotelFloorMapper.deleteHotelFloorByFloorIds(floorIds);
    }

    /**
     * 删除楼层信息
     *
     * @param floorId 楼层主键
     * @return 结果
     */
    @Override
    public int deleteHotelFloorByFloorId(Long floorId)
    {
        return hotelFloorMapper.deleteHotelFloorByFloorId(floorId);
    }
}
